package com.mindether.llyblog.service;

import com.mindether.llyblog.dao.ArticleMapper;
import com.mindether.llyblog.dao.CommentMapper;
import com.mindether.llyblog.pojo.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentService {

    @Autowired
    private CommentMapper commentMapper;

    @Autowired
    private ArticleMapper articleMapper;

    public List<Comment> findCommentListByArticleId(String articleId){
        return commentMapper.getCommentByArticleId(articleId);
    }

    public boolean addComment(Comment comment){
        commentMapper.add(comment);
        articleMapper.increaseArticleComment(comment.getArticleid());
        return true;
    }
}
